package com.ouc.common.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * nc相关的静态常数
 *
 * @author B504
 */
public class NcConstants {
  public static final String MULTY = "multy";

  public static final int INTERVAL = 2;

  public static final String UU = "uu";

  public static final String WINDU = "windu";

  public static final String WINDV = "windv";

  public static final String VV = "vv";

  public static final String CURRENT = "current";

  public static final String COPERNICUS = "copernicus";

  public static final String ESA = "esa";

  public static final String HYCOM = "hycom";

  public static final float BOUND = -180;

  public static final String DEGREEANDVALUE = "degreeandvalue";

  public static final String VHM0 = "VHM0";

  public static final String VMDR = "VMDR";

  public static final String WIND = "wind";

  public static final String ECMWF = "ecmwf";


  /**
   * pet暖涡
   */
  public static final String ANTICYCLONIC = "Ke-Anticyclonic";
  /**
   * pet冷涡
   */
  public static final String CYCLONIC = "Ke-Cyclonic";
  /**
   * 流场
   */
  public static final String CURRENTUV = "currentUV";
  /**
   * 风场
   */
  public static final String WINDUV = "windUV";
  /**
   * 浪场
   */
  public static final String WAVEUV = "waveUV";
  /**
   * petEddy的长周期表名
   */
  public static final String PETEDDYLONG = "pet_eddy_long";
  /**
   * petEddy的短周期表名
   */
  public static final String PETEDDYSHORT = "pet_eddy_short";
  /**
   * petEddy的未追踪到的涡旋表名
   */
  public static final String PETEDDYUNTRACKED = "pet_eddy_UNTRACKED";
  /**
   * 深度米数
   */
  public static final Float[] LEVEL_DEPTH = new Float[]{
      0.494025f, 1.541375f, 2.645669f, 3.819495f, 5.078224f, 6.440614f, 7.92956f, 9.572997f, 11.405f, 13.46714f, 15.81007f, 18.49556f, 21.59882f, 25.21141f, 29.44473f, 34.43415f, 40.34405f, 47.37369f, 55.76429f, 65.80727f, 77.85385f, 92.32607f, 109.7293f, 130.666f, 155.8507f, 186.1256f, 222.4752f, 266.0403f, 318.1274f, 380.213f, 453.9377f, 541.0889f, 643.5668f, 763.3331f, 902.3393f, 1062.44f, 1245.291f, 1452.251f, 1684.284f, 1941.893f, 2225.078f, 2533.336f, 2865.703f, 3220.82f, 3597.032f, 3992.484f, 4405.224f, 4833.291f, 5274.784f, 5727.917f
  };
  public static Map<Integer, Float> levelMap = new HashMap<>();

  public static final String[] VARIABLE_NAME_ARR = new String[]{"ml_d", "thc_ub", "thc_lb", "thc_d", "thc_s", "sscl_ub"
      , "sscl_lb", "ssca_d", "ssca_c", "dscl_ub", "dscl_lb", "dsca_d", "dsca_c", "sd_d", "sd_cf", "sd_cmax", "hc_j", "hc_cg"};
  /**
   * sobel算子的x，y
   */
  public static final float[][] GX = new float[][]{{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}};
  public static final float[][] GY = new float[][]{{-1, -2, -1}, {0, 0, 0}, {1, 2, 1}};

  static {
    getLevelMap();
  }

  /**
   * 声速变量中英文映射map
   */
  public static Map<String, String> variableSpeedMap = new HashMap<>();

  /**
   * 声速变量英文和单位映射
   */

  public static Map<String, String> variableSpeedUnitMap = new HashMap<>();

  static {
    getVariableSpeedMap();
  }

  static {
    getVariableSpeedUnitMap();
  }

  /**
   * 层级和米数关系
   * 使用了静态代码块
   * 正常来讲使用LEVEL_DEPTH就够了
   */
  public static void getLevelMap() {
    for (int i = 0; i < LEVEL_DEPTH.length; i++) {
      levelMap.put(i, LEVEL_DEPTH[i]);
    }
  }

  /**
   * 生成声速nc文件需要的
   */
  public static void getVariableSpeedMap() {
    variableSpeedMap.put("ml_d", "混合层厚度/表面声道厚度");
    variableSpeedMap.put("thc_ub", "声跃层上边界");
    variableSpeedMap.put("thc_lb", "跃层下边界/深海声道层上边界");
    variableSpeedMap.put("thc_d", "声跃层厚度");
    variableSpeedMap.put("thc_s", "声跃层强度");
    variableSpeedMap.put("sscl_ub", "浅海声道层上边界");
    variableSpeedMap.put("sscl_lb", "浅海声道层下边界");
    variableSpeedMap.put("ssca_d", "浅海声道轴深度");
    variableSpeedMap.put("ssca_c", "浅海声道轴声速");
    variableSpeedMap.put("dscl_ub", "深海声道层上边界");
    variableSpeedMap.put("dscl_lb", "深海声道下边界/深海等温层上界");
    variableSpeedMap.put("dsca_d", "深海声道轴深度");
    variableSpeedMap.put("dsca_c", "深海声道轴声速");
    variableSpeedMap.put("sd_d", "表面声道深度");
    variableSpeedMap.put("sd_cf", "表面声道截止频率");
    variableSpeedMap.put("sd_cmax", "表面声道最大声速");
    variableSpeedMap.put("hc_j", "半声道判断");
    variableSpeedMap.put("hc_cg", "半声道声速梯度");
    variableSpeedMap.put("czf_j", "会聚区形成与否");
    variableSpeedMap.put("czf_p", "会聚区形成概率");
    variableSpeedMap.put("cd", "临界深度");
    variableSpeedMap.put("de", "深度余量");
    variableSpeedMap.put("cz_r", "会聚区距离");
    variableSpeedMap.put("cz_g", "会聚区增益");
    variableSpeedMap.put("cz_w", "会聚区宽度");
    variableSpeedMap.put("dwo_r", "直达波作用距离");
  }

  public static void getVariableSpeedUnitMap() {
    variableSpeedUnitMap.put("ml_d", "m");
    variableSpeedUnitMap.put("thc_ub", "m");
    variableSpeedUnitMap.put("thc_lb", "m");
    variableSpeedUnitMap.put("thc_d", "m");
    variableSpeedUnitMap.put("thc_s", "s-1");
    variableSpeedUnitMap.put("sscl_ub", "m");
    variableSpeedUnitMap.put("sscl_lb", "m");
    variableSpeedUnitMap.put("ssca_d", "m");
    variableSpeedUnitMap.put("ssca_c", "m/s");
    variableSpeedUnitMap.put("dscl_ub", "m");
    variableSpeedUnitMap.put("dscl_lb", "m");
    variableSpeedUnitMap.put("dsca_d", "m");
    variableSpeedUnitMap.put("dsca_c", "m/s");
    variableSpeedUnitMap.put("sd_d", "m");
    variableSpeedUnitMap.put("sd_cf", "Hz");
    variableSpeedUnitMap.put("sd_cmax", "m/s");
    variableSpeedUnitMap.put("hc_j", "");
    variableSpeedUnitMap.put("hc_cg", "s-1");
    variableSpeedUnitMap.put("czf_j", "");
    variableSpeedUnitMap.put("czf_p", "");
    variableSpeedUnitMap.put("cd", "m");
    variableSpeedUnitMap.put("de", "m");
    variableSpeedUnitMap.put("cz_r", "m");
    variableSpeedUnitMap.put("cz_g", "");
    variableSpeedUnitMap.put("cz_w", "m");
    variableSpeedUnitMap.put("dwo_r", "m");
  }

}
